<?php
	/*
		@教学直播处理
	*/
	
	@$action = $_GET['action'];
	//处理方法
	if(empty($action) || !isset($action)){$action = "default";}

	if($action == "default"){
		$smarty->assign('title','先锋视频--教学直播');
		$smarty->display('live.tpl');
	}else if($action == "submit"){
		//取得数据参数
		$title = $_POST['title'];
		$userinfo = $_POST['userinfo'];
		$content = $_POST['content'];
		
		include_once("configs/database.inc.php");		//引入数据库配置
		
		//操作 
		if($D->connect()){
			$data = array(
						  	"title"		=> $title,
							"userinfo"	=> $userinfo,
							"content"	=> $content,
							"postdate"	=> date("Y-m-d H:i")
						  );
			$D->query("set names utf8");
			if($D->insert("feedback",$data)){
				echo "<script>alert(\"你的意见已经加入到数据库，谢谢！\");location.href=\"index.php?controller=feedback\";</script>";
			}else{
				echo "<script>alert(\"网络故障，稍后再试！\");location.href=\"index.php?controller=feedback\";</script>";
					
			}	
		}else{
			echo "<script>alert(\"数据库服务器忙，稍后再试！\");location.href=\"index.php?controller=feedback\";</script>";
		}
	}
?>